2 #ifndef FRAMELIB_CONTEXT_H 3 #define FRAMELIB_CONTEXT_H 29 return a.mGlobal == b.mGlobal && a.mReference == b.mReference;
47 template <
class T, T *(Global::*getMethod)(
void *),
void(Global::*releaseMethod)(
void *)>
55 ManagedPointer(
const FrameLib_Context &context) : mGlobal(context.mGlobal), mReference(context.mReference)
57 mPointer = (mGlobal->*getMethod)(mReference);
67 ManagedPointer(
const ManagedPointer&) =
delete;
68 ManagedPointer& operator=(
const ManagedPointer&) =
delete;
75 (mGlobal->*releaseMethod)(mReference);
83 T *operator->() {
return mPointer; }
84 operator bool()
const {
return mPointer !=
nullptr; }
103 using Allocator = ManagedPointer<FrameLib_LocalAllocator, &Global::getAllocator, &Global::releaseAllocator>;
104 using ProcessingQueue = ManagedPointer<FrameLib_ProcessingQueue, &Global::getProcessingQueue, &Global::releaseProcessingQueue>;
FrameLib_Context(FrameLib_Global *global, void *reference)
Definition: FrameLib_Context.h:99
a class for containing and managing FrameLib's global resources.
Definition: FrameLib_Global.h:28
a class used to represent distinct non-connectable areas in the host environment. ...
Definition: FrameLib_Context.h:21
ManagedPointer< FrameLib_LocalAllocator, &Global::getAllocator, &Global::releaseAllocator > Allocator
Definition: FrameLib_Context.h:103
a class used to report errors to the host environment.
Definition: FrameLib_Errors.h:34
friend bool operator==(const FrameLib_Context &a, const FrameLib_Context &b)
Definition: FrameLib_Context.h:27
friend bool operator!=(const FrameLib_Context &a, const FrameLib_Context &b)
Definition: FrameLib_Context.h:32
ManagedPointer< FrameLib_ProcessingQueue, &Global::getProcessingQueue, &Global::releaseProcessingQueue > ProcessingQueue
Definition: FrameLib_Context.h:104